package zongbang

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"net/http"
	"ruankepaiming-server/model/request"
	"ruankepaiming-server/service"
)

func ShowZongbangInfo(c *gin.Context){
	var Page request.Zongbangreq
	err := c.ShouldBind(&Page)
	if err != nil{
		fmt.Println("error!")

	}
    fmt.Println(Page)
	datas,total,err1:= service.GetZongbangPage(Page.Page,Page.Limit,Page)
	if err1!=nil{
		c.JSON(http.StatusNotFound, gin.H{"msg": "No data found","code":http.StatusNotFound })
		return

	}

	c.JSON(http.StatusOK, gin.H{"msg": "Get data successfully" ,"data":datas, "code":http.StatusOK,"total":total })

}

func ShowZhubangInfo(c *gin.Context){
	var Page request.Zhubangreq
	err := c.ShouldBind(&Page)
	if err != nil{
		fmt.Printf("error!")

	}
	fmt.Println(Page)
	datas,total,err1:= service.GetZhubangPage(Page.Page,Page.Limit,Page)
	if err1!=nil{
		c.JSON(http.StatusNotFound, gin.H{"msg": "No data found","code":http.StatusNotFound })
		return

	}

	c.JSON(http.StatusOK, gin.H{"msg": "Get data successfully" ,"data":datas, "code":http.StatusOK,"total":total })

}
func ShowMedicalInfo(c *gin.Context){
	var Page request.Medicalreq
	err := c.ShouldBind(&Page)
	if err != nil{
		fmt.Printf("error!")

	}
	fmt.Println(Page)
	datas,total,err1:= service.GetMedicalPage(Page.Page,Page.Limit,Page)
	if err1!=nil{
		c.JSON(http.StatusNotFound, gin.H{"msg": "No data found","code":http.StatusNotFound })
		return

	}

	c.JSON(http.StatusOK, gin.H{"msg": "Get data successfully" ,"data":datas, "code":http.StatusOK,"total":total })

}
func ShowFinanceInfo(c *gin.Context){
	var Page request.Financereq
	err := c.ShouldBind(&Page)
	if err != nil{
		fmt.Printf("error!")

	}
	fmt.Println(Page)
	datas,total,err1:= service.GetFinancePage(Page.Page,Page.Limit,Page)
	if err1!=nil{
		c.JSON(http.StatusNotFound, gin.H{"msg": "No data found","code":http.StatusNotFound })
		return

	}

	c.JSON(http.StatusOK, gin.H{"msg": "Get data successfully" ,"data":datas, "code":http.StatusOK,"total":total })

}

func ShowLanguageInfo(c *gin.Context){
	var Page request.Languagereq
	err := c.ShouldBind(&Page)
	if err != nil{
		fmt.Printf("error!")

	}
	fmt.Println(Page)
	datas,total,err1:= service.GetLanguagePage(Page.Page,Page.Limit,Page)
	if err1!=nil{
		c.JSON(http.StatusNotFound, gin.H{"msg": "No data found","code":http.StatusNotFound })
		return

	}

	c.JSON(http.StatusOK, gin.H{"msg": "Get data successfully" ,"data":datas, "code":http.StatusOK,"total":total })

}

func ShowLawInfo(c *gin.Context){
	var Page request.Lawreq
	err := c.ShouldBind(&Page)
	if err != nil{
		fmt.Printf("error!")

	}
	fmt.Println(Page)
	datas,total,err1:= service.GetLawPage(Page.Page,Page.Limit,Page)
	if err1!=nil{
		c.JSON(http.StatusNotFound, gin.H{"msg": "No data found","code":http.StatusNotFound })
		return

	}

	c.JSON(http.StatusOK, gin.H{"msg": "Get data successfully" ,"data":datas, "code":http.StatusOK,"total":total })

}

func ShowMinzuInfo(c *gin.Context){
	var Page request.Minzureq
	err := c.ShouldBind(&Page)
	if err != nil{
		fmt.Printf("error!")

	}
	fmt.Println(Page)
	datas,total,err1:= service.GetMinzuPage(Page.Page,Page.Limit,Page)
	if err1!=nil{
		c.JSON(http.StatusNotFound, gin.H{"msg": "No data found","code":http.StatusNotFound })
		return

	}

	c.JSON(http.StatusOK, gin.H{"msg": "Get data successfully" ,"data":datas, "code":http.StatusOK,"total":total })

}

func ShowTiyuInfo(c *gin.Context){
	var Page request.Tiyureq
	err := c.ShouldBind(&Page)
	if err != nil{
		fmt.Printf("error!")

	}
	fmt.Println(Page)
	datas,total,err1:= service.GetTiyuPage(Page.Page,Page.Limit,Page)
	if err1!=nil{
		c.JSON(http.StatusNotFound, gin.H{"msg": "No data found","code":http.StatusNotFound })
		return

	}

	c.JSON(http.StatusOK, gin.H{"msg": "Get data successfully" ,"data":datas, "code":http.StatusOK,"total":total })

}

func ShowHezuoInfo(c *gin.Context){
	var Page request.Hezuoreq
	err := c.ShouldBind(&Page)
	if err != nil{
		fmt.Printf("error!")

	}
	fmt.Println(Page)
	datas,total,err1:= service.GetHezuoPage(Page.Page,Page.Limit,Page)
	if err1!=nil{
		c.JSON(http.StatusNotFound, gin.H{"msg": "No data found","code":http.StatusNotFound })
		return

	}

	c.JSON(http.StatusOK, gin.H{"msg": "Get data successfully" ,"data":datas, "code":http.StatusOK,"total":total })

}

func ShowMinbanInfo(c *gin.Context){
	var Page request.Minbanreq
	err := c.ShouldBind(&Page)
	if err != nil{
		fmt.Printf("error!")

	}
	datas,total,err1:= service.GetMinbanPage(Page.Page,Page.Limit,Page)
	if err1!=nil{
		c.JSON(http.StatusNotFound, gin.H{"msg": "No data found","code":http.StatusNotFound })
		return

	}
	c.JSON(http.StatusOK, gin.H{"msg": "Get data successfully" ,"data":datas, "code":http.StatusOK,"total":total })

}

func ShowYishuInfo(c *gin.Context){
	var Page request.Yishureq
	err := c.ShouldBind(&Page)
	if err != nil{
		fmt.Printf("error!")

	}
	fmt.Println(Page)
	datas,total,err1:= service.GetYishuPage(Page.Page,Page.Limit,Page)
	if err1!=nil{
		c.JSON(http.StatusNotFound, gin.H{"msg": "No data found","code":http.StatusNotFound })
		return

	}

	c.JSON(http.StatusOK, gin.H{"msg": "Get data successfully" ,"data":datas, "code":http.StatusOK,"total":total })

}